package com.zb.vo;

import com.zb.annotation.NumberLengthPattern;
import com.zb.annotation.NumberPattern;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @Author WEN
 * @Date 2023/9/8 0008
 **/
@Data
@ApiModel("编码打印模板对象")
public class CodePrintTemplateVo {
    @ApiModelProperty(value = "模板ID，新增不必传，修改必传")
    private Long id;

    @NotBlank(message = "模板名称不能为空")
    @Length(max = 20, message = "模板名称限制 20 个字符以内")
    @ApiModelProperty(value = "模板名称", required = true)
    private String name;

    @NotNull(message = "纸张尺寸-高度不能为空")
    @NumberLengthPattern(max = 10, message = "纸张尺寸-高总长度限制 10 个字符以内")
    @NumberPattern(regexp = "^[1-9]\\d{1,3}|([1-9]\\d{1,3})(\\.[0-9]*)|0\\.([0-9]*)$", message = "纸张尺寸只能输入 >0 的并且最少输入两位正整数，且最多允许输入4位正整数")
    @ApiModelProperty(value = "纸张尺寸-高", required = true, example = "45")
    private Float height;

    @NotNull(message = "纸张尺寸-宽度不能为空")
    @NumberLengthPattern(max = 10, message = "纸张尺寸-宽总长度限制 10 个字符以内")
    @NumberPattern(regexp = "^[1-9]\\d{1,3}|([1-9]\\d{1,3})(\\.[0-9]*)|0\\.([0-9]*)$", message = "纸张尺寸只能输入 >0 的并且最少输入两位正整数，且最多允许输入4位正整数")
    @ApiModelProperty(value = "纸张尺寸-宽", required = true, example = "45")
    private Float width;

    @NotNull(message = "一码数量不能为空")
    @NumberPattern(regexp = "^[1-9]\\d{0,3}$", message = "一码数量只能输入 >0 的正正数，且最多允许输入4位正整数")
    @ApiModelProperty(value = "一码数量，即一个编码打印多少张", required = true, example = "2")
    private Integer codeNum;

    @NotNull(message = "单行数量不能为空")
    @NumberPattern(regexp = "^[1-9]\\d{0,3}$", message = "单行数量只能输入 >0 的正正数，且最多允许输入4位正整数")
    @ApiModelProperty(value = "单行数量", required = true, example = "2")
    private Integer rowQty;

    @NotNull(message = "模板状态不能为空")
    @ApiModelProperty(value = "模板状态：false-启用，true-禁用", required = true, example = "false")
    private Boolean status;

    @Valid
    @NotNull(message = "组件模板对象不能为空")
    @Size(min = 1, message = "组件模板至少填写一项")
    @ApiModelProperty(value = "组件模板对象")
    List<CodePrintTemplateComponentVo> templateComponentVos;

    @ApiModelProperty(value = "删除的组件/组件模板ID集合")
    private List<Long> delTemplateComponentIds;
}
